import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait

driver = webdriver.Chrome()
driver.maximize_window()
driver.get(r"D:\PyCharm\TPshop_webdemo\tool\test.html")

# TODO URL是否包含 TPshop_webdemo
element1 = WebDriverWait(driver, timeout=3).until(expected_conditions.url_contains('TPshop_webdemo'))
# TODO URL是否等于 file:///D:/PyCharm/TPshop_webdemo/tool/test.html
element2 = WebDriverWait(driver, timeout=3).until(expected_conditions.url_to_be("file:///D:/PyCharm/TPshop_webdemo/tool/test.html"))
print(element1)
print(element2)


# TODO 打印当前URL
print(driver.current_url)


time.sleep(2)